﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    <script type="text/ecmascript">
        function is17(obj) {
            var p = /^[A-HJ-NPR-Z0-9]{17,17}$/;
            return p.test(obj);
        }

        function checkclsbdh(clsbdh) {
            var intquan = new Array(8, 7, 6, 5, 4, 3, 2, 10, 9, 8, 7, 6, 5, 4, 3, 2);
            var strjiaoyan = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "X");
            var cha = "00112233445566778899A1B2C3D4E5F6G7H8J1K2L3M4N5P7R9S2T3U4V5W6X7Y8Z9";
            var ssum = 0;
            var i;
            var j;
            var jyw;
            var dqw;
            jyw = clsbdh.substring(8, 9);
            clsbdh = clsbdh.substring(0, 8) + clsbdh.substring(9, 17);
            for (i = 0; i <= 15; i++) {
                dqw = clsbdh.substring(i, i + 1);
                for (j = 0; j <= 65; j += 2) {
                    if (dqw == cha.substring(j, j + 1)) {
                        dqw = cha.substring(j + 1, j + 2);
                        j = 67;
                    }
                }
                if (j < 67) {
                    return false;
                }
                ssum = ssum + dqw * intquan[i];
            }
            ssum = ssum % 11;
            ssum = strjiaoyan[ssum];
            if (ssum == jyw) {
                return true;
            } else {
                return false;
            }
        }

        alert(checkclsbdh("LSVEG39F3S2494501"));
    </script>
</head>
<body>

</body>
</html>
